#pragma once
#include <iostream>
#include <vector>
#include <time.h>
using namespace std;

template<class T> //T大小
class NewObject
{
public:
	T* New()
	{
        T* obj = nullptr;
        obj = (T*)malloc(sizeof(T));//K
		if (obj == nullptr)
		{
			throw std::bad_alloc();
		}
		// 定位new, 显示调用T的构造函数初始化
		new(obj)T;
		return obj;
	}

	void Delete(T* obj)
	{
		//显示调用析构函数清理对象
		obj->~T();
        free(obj);
	}
};